THRIFT-6013: Add recursion depth limit to skip() in Ruby library#3499
Merged
Conversation
kpumuk
approved these changes
May 19, 2026
Member
kpumuk
left a comment
There was a problem hiding this comment.
note for myself: this change only covers the generic unknown-field skip() path. Expected-field deserialization still recurses without a limit for nested structs.
That makes this narrower than the Ruby configuration plan in THRIFT-5938, which calls for config-driven recursion enforcement in skip, generated reads, generated writes, and native paths (still in progress).
Client: rb Aligns the Ruby skip() implementation with Java, Python, Go and netstd, which already enforce a configurable recursion depth limit. Adds a max_depth parameter (default 64) and raises ProtocolException::DEPTH_LIMIT when exceeded. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
max_depthparameter (default 64) toBaseProtocol#skipProtocolException::DEPTH_LIMITwhen the depth limit is exceededbase_protocol_spec.rbcovering the limit boundaryTest plan
spec/base_protocol_spec.rb— new tests: raisesDEPTH_LIMITatmax_depth=0, no raise atmax_depth=1for a leaf typeshould skip structs/maps/sets/lists) continue to pass🤖 Generated with Claude Code